package com.teapos.enumtype;

public enum WeekEnum {
	
	MONDAY(1, "周一"),
	TUESDAY(2, "周二"),
	WEDNESDAY(3, "周三"),
	YHURSDAY(4, "周四"),
	FRIDAY(5, "周五"),
	SATURDAY(6, "周六"),
	SUNDAY(7, "周日");
	
	private int code;
	private String desc;
	private WeekEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	public static WeekEnum getEnumByCode(int code) {
		WeekEnum[] enums = WeekEnum.values();
		for(WeekEnum enumtype:enums) {
			if(enumtype.getCode()==code) return enumtype;
		}
		return null;
	}

}
